﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
using Documents.Common.Interfaces;
using System.Collections;

namespace Documents.web.Models
{
    public class DashboardViewModel
    {
        public XmlDocument Locations { get; set; }
        public string LocationName { get; private set; }
        public int InPatientCount { get; private set; }
        public int DischargeCount { get; private set; }
        public int AdmissionCount { get; private set; }
        public int? WardID { get; private set; }

        public DashboardViewModel(IPasHelper pasHelper, int? wardid, string locationname)
        {
            Locations = pasHelper.Locations();
            LocationName = locationname;
            WardID = wardid ?? 0;
            XmlDocument InPatientList = pasHelper.InPatients(WardID.ToString(), null, null);
            XmlNodeList patients = InPatientList.SelectNodes(@"Patients/PatientListCareProcessStatusResponse");
            InPatientCount = patients.Count;

            XmlDocument DischargePatientList = pasHelper.Discharges(WardID.ToString(), null, null);
            patients = DischargePatientList.SelectNodes(@"Patients/PatientListCareProcessStatusResponse");
            DischargeCount = patients.Count;

            AdmissionCount = 3;
        }
    }
}
